package ru.aptu.billing_message;

import java.io.Serializable;

/**
 * Created by IntelliJ IDEA.
 * User: andrey
 * Date: 12/22/11
 * Time: 9:56 PM
 */

public class BasicMessage implements Serializable {

    public static int currentProtocolVersion = 1;

    protected static long currentID = 0;

    protected int protocolVersion;

    protected long msgID;

    protected MessageType msgType;

    protected MessageDirection msgDirection;

    public BasicMessage(MessageDirection msgDirection, MessageType msgType) {
        this.protocolVersion = currentProtocolVersion;
        this.msgDirection = msgDirection;
        this.msgType = msgType;
    }

    public int getProtocolVersion() {
        return protocolVersion;
    }

    public long getID() {
        return msgID;
    }

    public MessageType getType() {
        return msgType;
    }

    public MessageDirection getDirection() {
        return msgDirection;
    }


    public static enum MessageDirection {
        REQUEST,
        RESPONSE
    }

    public static enum Status {
        OK,
        BAD_MESSAGE,

        UNSUPPORTED_PROTOCOL,

        ACC_INVALID,
        ACC_BLOCKED,
        SERVICE_UNKNOWN,
        SERVICE_UNAVAILABLE,

        BAD_CURRENCY,
        BAD_AMOUNT,
        DUPLICATE_TRN
    }

    public static enum MessageType {
        CHECK_PROTOCOL,
        CHECK_ACCOUNT,
        REQUEST_TRANSACTION
    }

    public static enum ServiceType {
        EMPTY,

        MOBILE_PHONE,
        INTERNET,

        WATER,
        ELECTRICITY
    }

}
